package com.atguigu.test05.test06;

import java.sql.Connection;

/**
 * @author haoranlu
 * @project IntelliJ IDEA
 */
public class TestJDBCToolsV2 {
    public static void main(String[] args) throws Exception {
        String sql1 = "update t_department set description = 'xx' where did = 10";
        String sql2 = "update t_department set description = 'yy' where did = 9";

        Connection conn = JDBCToolsV2.getConnection();
        conn.setAutoCommit(false);

        try{
            JDBCToolsV2.update(sql1);
            JDBCToolsV2.update(sql2);
            conn.commit();
        }catch (Exception e){
            e.printStackTrace();
            conn.rollback();
        }
        conn.setAutoCommit(true);
        JDBCToolsV2.free(conn);
    }
}
